using System;
public class MissonItem : BaseItem
{
	
	private Misson misson;
	public UILabel starLabel;
	public UILabel nameLabel;
	public UISprite missonLock;
	public MissonManager manager{
		get{
			return (MissonManager)GameManager.GetInstatnce().GetManager(ManagerType.MISSION);
		}
	}
	#region implemented abstract members of BaseItem
	public override void SetItem (object obj)
	{
		misson = (Misson)obj;
		Refresh ();
	}

	public override object GetItem ()
	{
		return misson;
	}
	public override void Refresh ()
	{
		nameLabel.text = misson.name;
		starLabel.text = misson.star.ToString();
		if(misson.isOpen){
			NGUITools.SetActive(missonLock.gameObject,false);
		}else{
			NGUITools.SetActive(missonLock.gameObject,true);
		}
	}
	#endregion
	public void SelectMisson(){
		if(misson.isOpen){
			manager.SelectMission(misson);
			GameManager.GetInstatnce().ShowPanel(PanelName.GamePanel);
		}
	}
}


